/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
 */
/**
 * @param {TreeNode} root
 * @return {boolean}
 * 判断树形为左右对称型结构
 */
var isSymmetric = function(root) {

    var floor = 0;
    var num = 0;
    var res = 1;
    //console.log(root.length)
    if(root.length <= 1)
    {
        return res;
    }

    for(var i = 0; i < root.length; i++)
    {

        if(i == num && num+1 < root.length)
        {

            floor++;
            var fNum = Math.pow(2, floor)
            num = num + fNum;
            for(var j = 1; j <= fNum/2; j++)
            {
                if(root[i+j] != root[num+1-j])
                {
                    res = 0;
                }
            }

        }
    }
    return res;
};



var prices1 = [1,2,2,5,6,6,5] //[1,2,2,null,3,null,3] //[1,2,2,3,4,4,3,]

var res1 = isSymmetric(prices1);
console.log(res1);